<!DOCTYPE html>
<html>


<head>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<title>参数设置</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link href="${ctx}/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
	<link href="${ctx}/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
	<link href="${ctx}/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="${ctx}/css/animate.min.css" rel="stylesheet">
	<link href="${ctx}/css/style.min862f.css?v=4.1.0" rel="stylesheet">
	<link rel="stylesheet" href="${ctx}/css/labelauty.css"/>
	<link href="${ctx}/css/select2.min.css?v=1.0" rel="stylesheet"/>
	<style type="text/css">
		/*试题参数设置按钮*/
		.setting-button-exam {
			padding-left: 50px;
		}

		.control-label-text-align-left {
			padding-top: 7px;
			margin-bottom: 0;
			text-align: left;
			padding-left: 50px;
		}
	</style>
<#--表单验证，显示错误信息-->
	<style type="text/css">
		input.error {
			background: rgb(251, 227, 228);
			border: 1px solid #fbc2c4;
			color: red;
		}

		label.error {
			color: red;
			display: inline-block;
		}
	</style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="row">
		<div class="col-sm-12">
			<div class="tabs-container">
				<ul class="nav nav-tabs" id="mytable">
					<li class="active">
						<a data-toggle="tab" href="#tab-1" aria-expanded="true"> 试卷参数</a>
					</li>
					<li class="">
						<a data-toggle="tab" href="#tab-2" aria-expanded="false">试题参数</a>
					</li>
				</ul>
				<div class="tab-content">
					<div id="tab-1" class="tab-pane active">
						<div class="panel-body">
							<form class="form-horizontal">
								<div class="form-group">
									<label class="col-sm-2 control-label">穴位出现一次：</label>
									<div class="col-sm-10">
										<select id="set_acupoint_one" class="form-control">
										</select>
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-2 control-label">穴位出现两次：</label>
									<div class="col-sm-10">
										<select id="set_acupoint_two" class="form-control">
										</select>
									</div>
								</div>
								<div class="text-right" style="margin-top: 20px">
									<a class="btn btn-primary" onclick="get_acupoint()" ><i
											class="glyphicon glyphicon-floppy-saved"></i>&nbsp;设置穴位
									</a>
								</div>
							</form>
						</div>
					</div>
					<div id="tab-2" class="tab-pane">
						<div class="panel-body">
							<div class="row">
                            <#--穴位定位-成人穴位-->
								<form class="form-horizontal" id="form-acupoint-location-adult">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">穴位定位</span>-成人穴位</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
                                    <#--部位分数-->
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">部位分数不得大于：</label><#if examParamAcupointLocationAdult ??></#if>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxPartScore" class="form-control"
												       value="<#if examParamAcupointLocationAdult ??>${examParamAcupointLocationAdult.maxPartScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
                                    <#--归经分数-->
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">归经分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxMeridianScore" class="form-control"
												       value="<#if examParamAcupointLocationAdult ??>${examParamAcupointLocationAdult.maxMeridianScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
                                    <#--定位分数-->
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">定位分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxLocationScore" class="form-control"
												       value="<#if examParamAcupointLocationAdult ??>${examParamAcupointLocationAdult.maxLocationScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamAcupointLocationAdult ??>${examParamAcupointLocationAdult.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
                            <#--穴位定位-儿科穴位-->
								<form class="form-horizontal" id="form-acupoint-location-pediatric">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">穴位定位</span>-儿科穴位</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">部位分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxPartScore" class="form-control"
												       value="<#if examParamAcupointLocationPediatric ??>${examParamAcupointLocationPediatric.maxPartScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">具体部位分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxPartDetailScore" class="form-control"
												       value="<#if examParamAcupointLocationPediatric ??>${examParamAcupointLocationPediatric.maxPartDetailScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">定位分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxLocationScore" class="form-control"
												       value="<#if examParamAcupointLocationPediatric ??>${examParamAcupointLocationPediatric.maxPartDetailScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamAcupointLocationPediatric ??>${examParamAcupointLocationPediatric.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
							</div>
							<div class="row">
                            <#--单项手法-成人、儿科、触诊-->
								<form class="form-horizontal" id="form-single-ploy-CEC">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">单项手法</span>-成人、儿科、触诊</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
                                    <#--答案-->
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">答案分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxAnswerScore" class="form-control"
												       value="<#if examParamSinglePloyCEC ??>${examParamSinglePloyCEC.maxAnswerScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamSinglePloyCEC ??>${examParamSinglePloyCEC.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
                            <#--成套手法-伤科、妇科、儿科、内科-->
								<form class="form-horizontal" id="form-complete-ploy-FSEN">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">成套手法</span>-伤科、妇科、儿科、内科</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">答案分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxAnswerScore" class="form-control"
												       value="<#if examParamCompletePloyFSEN ??>${examParamCompletePloyFSEN.maxAnswerScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamCompletePloyFSEN ??>${examParamCompletePloyFSEN.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
							</div>
							<div class="row">
                            <#--问答题-腧穴题-->
								<form class="form-horizontal" id="form-wenda-acupoint">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">问答题</span>-腧穴题</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">定位分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxLocationScore" class="form-control"
												       value="<#if examParamWendaAcupoint ??>${examParamWendaAcupoint.maxLocationScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">归经分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxMeridianScore" class="form-control"
												       value="<#if examParamWendaAcupoint ??>${examParamWendaAcupoint.maxMeridianScore}</#if>"
												       placeholder="请输入分数上限值......">

											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">主治分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxMayorCureScore" class="form-control"
												       value="<#if examParamWendaAcupoint ??>${examParamWendaAcupoint.maxMayorCureScore}</#if>"
												       placeholder="请输入分数上限值......">

											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamWendaAcupoint ??>${examParamWendaAcupoint.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
                            <#--问答题-伤科、妇科、儿科、内科、触诊-->
								<form class="form-horizontal" id="form-wenda-ploy-FSENC">
									<div class="col-md-6">
										<div class="form-group" style="color: #1c84c6">
											<label class="col-sm-8 control-label-text-align-left"><span
													style="font-size: 20px">问答题</span>-伤科、妇科、儿科、内科、触诊</label>
                                        <#--设置按钮-->
											<div class="col-sm-4 setting-button-exam">
												<button class="btn btn-primary" type="submit"><i
														class="glyphicon glyphicon-wrench"></i>&nbsp;设置
												</button>
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">答案分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxAnswerScore" class="form-control"
												       value="<#if examParamWendaFSENC ??>${examParamWendaFSENC.maxAnswerScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
										<div class="form-group">
											<label class="col-sm-5 control-label-text-align-left">总分分数不得大于：</label>
											<div class="col-sm-6 display-error">
												<input type="number" name="maxTotalScore" class="form-control"
												       value="<#if examParamWendaFSENC ??>${examParamWendaFSENC.maxTotalScore}</#if>"
												       placeholder="请输入分数上限值......">
											</div>
										</div>
									</div>
								</form>
							</div>
						</div>
					</div>
				</div>
				<!-----------------------------------------------------------试题参数------------------------------------------------------------->

			</div>

		</div>
	</div>
</div>
<script src="${ctx}/js/jquery.min.js?v=2.1.4"></script>
<script src="${ctx}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${ctx}/js/labelauty.js"></script>
<script src="${ctx}/js/plugins/layer/layer.js"></script>
<script src="${ctx}/js/select2.full.min.js"></script>
<#--表单验证-->
<script src="${ctx}/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctx}/js/plugins/validate/validate-methods.js"></script>
<script src="${ctx}/js/plugins/validate/jquery-form.js"></script>
<script src="${ctx}/js/plugins/validate/messages_zh.min.js"></script>
<script>
	$(document).ready(function () {
		//参数{input类名，选择类型(单选or多选)}
		$(".rdolist").labelauty("rdolist", "rdo");
		$('#set_acupoint_one').select2({
			placeholder: "请选择穴位",
			multiple: true,
			ajax: {
				url: '${ctx}/system/getAdultAcupoint',
				formatResult:function (data) {
				}
			}
		})

		$('#set_acupoint_two').select2({
			placeholder: "请选择穴位",
			multiple: true,
			ajax: {
				url: '${ctx}/system/getAdultAcupoint',
				formatResult:function (data) {

				}
			}
		})

		var one = $('#set_acupoint_one');
		var two = $('#set_acupoint_two');
		$.ajax({
			url: "${ctx}/system/getSetAcupoint",
			dataType:'json',
			success: function (result) {
			    var data = result.results;
				for (var i = 0; i < data.length; i++) {
					var item = data[i];
					if(item.count == 1){
						var option = new Option(item.text, item.acupointId, true, true);
						one.append(option);
                    }else if(item.count == 2){
						var option = new Option(item.text, item.acupointId, true, true);
						two.append(option);
                    }
				}
				one.trigger('change');//使用这个方法显示到select2上.
				two.trigger('change');//使用这个方法显示到select2上.
			}
		});
	})
    
    function get_acupoint() {
	    var one = $('#set_acupoint_one');
	    var two = $('#set_acupoint_two');
	    var json = [];
	    var result1 = one.select2('data');
	    var result2 = two.select2('data');
	    $(result1).each(function(i,element){
		    var a = {};
		    a.acupointId = this.id;
		    a.text = this.text;
		    a.count = 1;
		    json.push(a);
        });
	    $(result2).each(function(i,element){
		    var b = {};
		    b.acupointId = this.id;
		    b.text = this.text;
		    b.count = 2;
		    json.push(b);
	    });
	    $.ajax({
            url:'${ctx}/system/setAcupoint',
            data:JSON.stringify(json),
            type:"POST",
		    contentType:"application/json",
		    dataType : "json",
		    success:function(data){
			    if (data.status == 200) {
				    layer.msg('设置成功！', {
					    icon: 1,
					    time: 2000
				    });
			    }else {
				    layer.msg('设置失败！', {
					    icon: 2,
					    time: 2000
				    });
                }
            }
        })
    }
	$(document).ready(function () {
		/*穴位定位-成人穴位*/
		$("#form-acupoint-location-adult").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/acupointLocationAdult",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxPartScore: {
					required: true,
					min: 0
				}, maxMeridianScore: {
					required: true,
					min: 0
				}, maxLocationScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
		/*穴位定位-儿科穴位*/
		$("#form-acupoint-location-pediatric").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/acupointLocationPediatric",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxPartScore: {
					required: true,
					min: 0
				}, maxPartDetailScore: {
					required: true,
					min: 0
				}, maxLocationScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
		/*单项手法-成人、儿科、触诊*/
		$("#form-single-ploy-CEC").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/singlePloyCEC",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxAnswerScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
		/*成套手法-妇、伤、儿、内科*/
		$("#form-complete-ploy-FSEN").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/completePloyFSEN",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxAnswerScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
		/*问答题-腧穴*/
		$("#form-wenda-acupoint").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/wendaAcupoint",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxMayorCureScore: {
					required: true,
					min: 0
				}, maxMeridianScore: {
					required: true,
					min: 0
				}, maxLocationScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
		/*问答题-内科、伤科、妇科、儿科、触诊*/
		$("#form-wenda-ploy-FSENC").validate({
			submitHandler: function (form) {
				$.ajax({
					url: "${ctx}/exam/param/set/put/wendaFSEN",
					type: "put",
					dataType: "json",
					data: $(form).serialize(),
					timeout: 20000,
					success: function (data) {
						if (data.code == 0) {
							layer.msg(data.msg, {
								icon: 1,
								time: 3000
							});
						}
					},
					error: function (xhr, textstatus, thrown) {
						alert("error")
					}
				});
			},
			errorPlacement: function (error, element) {
				element.closest('.display-error').append(error);//显示错误消息提示
			},
			rules: {
				maxAnswerScore: {
					required: true,
					min: 0
				}, maxTotalScore: {
					required: true,
					min: 0
				}
			},
			messages: {}
		});
	});
</script>
</body>

</html>